Passing Data Between Tasks
In this section you will add another task to your automation and pass variable data to it.
Prepare the Canvas
Let's prepare the Gen 2 workflow canvas by adding another task.
Go back to the Automation Studio tab.
- If you closed the application tab, simply go to the IAP home screen and click the "Automation Studio" option in the left navigation menu.
- Select Find an Automation and search for the "EnlightenMe" automation you created previously.
Click on the transition line between the FetchFact and End nodes.
Figure 1: Insert Node
Select "Insert Node" from the context menu.
Another "New Node" will appear in line between the two existing nodes.
Click the New Node to bring it into focus.
In the Task Menu Sidebar, search for the "WorkflowEngine" Query task.
Click the Query task to replace the New Node.
Click the Save icon (left side of canvas) to save your work.
You should now have four different (yet connected) tasks on your canvas:
START
FetchFact
Query
END
Figure 2. Add Query Task
Configure the Query Task
Next, let's configure the variable information.
If not already selected, click the Query task on the canvas to view the details for the task in the right-side menu.
From the Details tab, change the value in the Summary field from Query Data Using 'json-query' Format to IsolateFact. This will help us distinquish this restCall task from others later on.
Change the Description field to read "Just give me the fact".
Click the Variables tab.
For this example, set the Value of the
pass_on_null
variable using the slider button to "False" (the slider will be in the left position). This tells the automation to "fail" the task in Job Manager if no value is provided.Figure 3. Pass_on_null
Set the Value of the
query
variable tovalue.joke
.Figure 4. Query Value
You're probably asking where did
value.joke
come from? To see the origin, go back to the Job Manager tab you left open. Refer to theresponse
variable in the OUTGOING tab of the Task History. The response was provided in the form of a JSON object.- In the JASONPath syntax of the
response
, find wherevalue.joke
exists as a key-value pair.
Note: For more information on JSONPath syntax, we recommend reading JSONPath-XPath for JSON. We also recommend the JSONPath Online Evaluator when experimenting with JSONPath data extraction.
- In the JASONPath syntax of the
Change the
obj
Reference Task from "static" toFetchFact
and accept the defaultresponse
that displays. This indicates the data you want to search will be provided by the results of the FetchFact task.Figure 5. Query Object
Click the Save icon (left side of canvas) to save your work.
Run the Automation
To test the automation and see if it works:
- Click the blue Play icon (►) to the right of the Save icon on the canvas. A modal window will open.
- For now, ignore the entries for "Description" and "Groups".
- Click the START button in the left corner of the modal. A modal window will display.
- Within the modal window, there's a message link that says VIEW JOB. Once you click the link, a new tab opens in your browser. This new tab displays the Job Manager view of the running job you just started.
Viewing the Job
In the newly opened Job Manager tab, take a moment to study the page to see the different types of information that's available in this view. This time, two tasks are displayed:
IsolateFact
FetchFact
Figure 6. Job Details
- Click the book icon at the end of the IsolateFact task.
- The Outgoing tab in the Task History reveals the value of the
return_data
variable, indicating that you successfully isolated the incoming fact from the data that was returned by the Query task.
Figure 7. Outgoing Task History
Summary Wrap-Up
Congratulations on completing this segment of the tour! By now, you should know how to:
- Build an automation.
- Pass variable data between tasks in an automation.
- Use the Query task.
In the next section, you will learn how to customize the input values.